﻿-- Creating table 'FactorValues'
CREATE TABLE [dbo].[FactorValues] (
    [FactorValueId] int IDENTITY(1,1) NOT NULL,
    [Value] float  NOT NULL,
    [CreateOn] datetime  NOT NULL,
    [DeleteOn] datetime  NULL,
    [FactorId] int  NOT NULL
);
GO
-- Creating foreign key on [FactorId] in table 'FactorValues'
ALTER TABLE [dbo].[FactorValues]
ADD CONSTRAINT [FK_FactorFactorValue]
    FOREIGN KEY ([FactorId])
    REFERENCES [dbo].[Factors]
        ([FactorId])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO
-- Creating primary key on [FactorValueId] in table 'FactorValues'
ALTER TABLE [dbo].[FactorValues]
ADD CONSTRAINT [PK_FactorValues]
    PRIMARY KEY CLUSTERED ([FactorValueId] ASC);
GO
-- Creating non-clustered index for FOREIGN KEY 'FK_FactorFactorValue'
CREATE INDEX [IX_FK_FactorFactorValue]
ON [dbo].[FactorValues]
    ([FactorId]);